import React from 'react';

export default class Button extends React.Component {
    constructor(props) {
        super(props);
        this.onClick = this.onClick.bind(this, this.props.value);
    }

    onClick(val) {
        return this.props.onClick(val);
    }

    render() {
        return (
            <button type="button" className={`btn ${this.props.class}`} onClick={this.onClick}>{this.props.text}</button>
        );
    }
}

Button.propTypes = {
    text: React.PropTypes.string,
    value: React.PropTypes.string,
    class: React.PropTypes.string,
    onClick: React.PropTypes.func,
}
